package com.dahaiwuliang.code.dao;


import com.dahaiwuliang.code.pojo.UserDownload;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

/**
 * @author bzd
 */
@Repository
public interface UserDownloadDao  extends JpaRepository<UserDownload,Integer>,JpaSpecificationExecutor<UserDownload> {


    /**
     * 查询某个用户下某个资源的次数
     */
    @Query(value = "select count(*) from user_download where user_id=?1 and article_id=?2",nativeQuery = true)
   Integer getCountByUserIdAndArticleId(Integer userId,Integer articleId);

}
